package com.jinzhi.jzweb.controller;

import com.jinzhi.common.utils.Result;
import com.jinzhi.jzweb.domain.MarkDO;
import com.jinzhi.jzweb.domain.MarkVO;
import com.jinzhi.jzweb.domain.StuSignUpComDO;
import com.jinzhi.jzweb.service.MarkService;
import com.jinzhi.jzweb.service.StuSignUpComService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/jzweb/indexStatistics")
public class IndexStatisticsController {

    @Autowired
    private StuSignUpComService stuSignUpComService;

    private final MarkService markService;
    @Autowired
    public IndexStatisticsController(MarkService markService) {
        this.markService = markService;
    }

    /**
     * 信息统计
     * @param stuSignUpComDTO
     * @return
     */
    @ApiOperation(value = "信息统计", notes = "信息统计")
    @ApiResponses({@ApiResponse(code = 0, message = "操作成功"),
            @ApiResponse(code = 500, message = "服务器内部异常")})
    @ResponseBody
    @PostMapping("/statistics")
    public Result<StuSignUpComDO> statistics(@RequestBody StuSignUpComDO stuSignUpComDTO){
        StuSignUpComDO statistic = stuSignUpComService.statistic(stuSignUpComDTO);

        return Result.ok(statistic);
    }

    /**
     * 考生成绩统计
     * @param markDTO
     * @return
     */
    @ApiOperation(value = "考生成绩统计", notes = "考生成绩统计")
    @ApiResponses({@ApiResponse(code = 0, message = "操作成功"),
            @ApiResponse(code = 500, message = "服务器内部异常")})
    @ResponseBody
    @PostMapping("/scoreStatistics")
    public Result<MarkVO> statistics(@RequestBody MarkDO markDTO){
        MarkVO markVO = markService.queryScoreStatistics(markDTO);

        return Result.ok(markVO);
    }

}
